#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
int n,d[50001][2];
vector < int > s[50001];
void dp(int jiang,int frog){
	d[jiang][1]=1;
	for(int i=0;i<s[jiang].size();i++){
		int dong=s[jiang][i];
		if(dong==frog)continue;
		else dp(dong,jiang);
		d[jiang][1]+=d[dong][0];
		d[jiang][0]+=max(d[dong][1],d[dong][0]);
	}
	
}
int main(){
	scanf("%d",&n);
	for(int x,y,i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		s[x].push_back(y);
		s[y].push_back(x);
	}
	dp(1,0);
	printf("%d",max(d[1][0],d[1][1]));
	return 0;
}
